<template>
  <sweet-button text @click="dialogVisible = true"> click to open the Dialog </sweet-button>

  <!-- <sweet-dialog v-model="dialogVisible" title="Tips" width="30%" :before-close="handleClose" append-to-body> -->
  <sweet-dialog v-model="dialogVisible" title="Tips" width="30%" :before-close="handleClose">
    <span>This is a message</span>
    <template #footer>
      <span class="dialog-footer">
        <sweet-button @click="dialogVisible = false">Cancel</sweet-button>
        <sweet-button type="primary" @click="dialogVisible = false"> Confirm </sweet-button>
      </span>
    </template>
  </sweet-dialog>
</template>

<script setup>
import {ref} from 'vue';
import {SweetMessageBox} from '@hw-seq/sweet-ui-base';

const dialogVisible = ref(false);

const handleClose = done => {
  SweetMessageBox.confirm('Are you sure to close this dialog?')
    .then(() => {
      done();
    })
    .catch(() => {
      // catch error
    });
};
</script>
<style scoped></style>
